class PersonController {

    def scaffold = Person

    def UserService userService

    def authenticate = {
        def person = this.userService.queryPerson(params.username,params.password)

        if(!person){
            flash.message = "login failed";
        } else{
            session.user = person
        }
        redirect(view:"")
    }
    
    def logout = {
        if(session.user)
            session.user = null
        redirect(view:"")
    }
}
